# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

_pkgname=flask-security
pkgname=python-flask-security-too
pkgver=4.1.6
pkgrel=2
pkgdesc='Quick and simple security for Flask applications'
url='https://github.com/jwag956/flask-security'
arch=('any')
license=('MIT')
depends=('python' 'python-flask' 'python-flask-login' 'python-flask-mail' 'python-flask-principal'
         'python-flask-wtf' 'python-flask-babelex' 'python-itsdangerous' 'python-passlib'
         'python-email-validator')
makedepends=('python-flask' 'python-flask-login' 'python-flask-mail' 'python-flask-principal'
             'python-flask-wtf' 'python-flask-babelex' 'python-itsdangerous' 'python-passlib'
             'python-sphinx' 'python-setuptools' 'python-pallets-sphinx-themes' 'python-sphinx-issues')
checkdepends=('python-pytest' 'python-pytest-runner' 'python-pytest-cov' 'python-peewee'
              'python-sqlalchemy' 'python-flask-sqlalchemy' 'python-bcrypt' 'python-pony'
              'python-flask-babel' 'python-zxcvbn' 'python-cryptography' 'python-pyqrcode' 'python-bleach'
              'python-phonenumbers' 'python-argon2_cffi')
provides=('python-flask-security')
conflicts=('python-flask-security')
source=(https://github.com/jwag956/flask-security/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('02de6e0ace63d9ac3558406a346e821f2fdab606033c70425105df9c7ff90e205d027d1c6c198fa3c0b9f61dd5face2f3c5180641d97fed63b3161b5fb04c1bc')
b2sums=('79e3c2e0d4ae4cbfc94edf943d5b5b2f51beeb0b2e40854f8e3663cc38e573dc6eece1b1568a324aa3c619784387a2bf05e9d418f31131670d60b01f713b51ee')

prepare() {
  cd ${_pkgname}-${pkgver}
  sed -e 's/ --translations//' \
      -e 's/ --pep8//' \
      -e 's/ --black//' \
      -e 's/ --flake8//' \
      -e 's/ --flakes//' \
      -i pytest.ini
}

build() {
  cd ${_pkgname}-${pkgver}
  python setup.py build
  python setup.py compile_catalog
  sphinx-build -b text docs docs/_build/text
  sphinx-build -b man docs docs/_build/man
}

check() {
  cd ${_pkgname}-${pkgver}
  PYTHONPATH=build/lib pytest
}

package() {
  cd ${_pkgname}-${pkgver}
  python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
  install -Dm 644 README.rst CHANGES.rst -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -Dm 644 docs/_build/text/*.txt -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 docs/_build/man/flask-security.1 "${pkgdir}/usr/share/man/man1/${pkgname}.1"
  install -Dm 644 docs/_build/man/flask-security.1 "${pkgdir}/usr/share/man/man1/python-flask-security.1"
}

# vim: ts=2 sw=2 et:
